#include<bits/stdc++.h>
#define int long long
#define db long double
using namespace std;
const int N=1e6+5;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=(x<<1)+(x<<3)+ch-48,ch=getchar();}
	return x*f;
}
int n,h[N],r[N],R[N];
db dep[N];

signed main(){
	freopen("wan.in","r",stdin);
	freopen("wan.out","w",stdout);
	n=read();
	for(int i=1;i<=n;i++) h[i]=read(),r[i]=read(),R[i]=read();
		
	for(int i=2;i<=n;i++){
		for(int j=i-1;j>=1;j--){
			db res=0;
			if(r[i]>=R[j]){
				dep[i]=max(dep[i],(db)h[j]+dep[j]);
				continue;
			}
			int d1=(R[i]-r[i]),d2=(R[j]-r[j]);
			if(r[i]>r[j]&&1ll*d1*h[j]<1ll*d2*h[i]){
				db dert1=(db)h[j]*((db)r[i]-(db)r[j])/((db)R[j]-(db)r[j]);
				res=max(res,dert1);
			}
			if(R[i]>R[j]&&1ll*d1*h[j]>1ll*d2*h[i]){
				db dert1=(db)h[j]-(db)h[i]*((db)R[j]-(db)r[i])/((db)R[i]-(db)r[i]);
				res=max(res,dert1);
			}
			dep[i]=max(dep[i],(db)dep[j]+(db)res);
		}
	}
	db ans=0;
	for(int i=1;i<=n;i++) ans=max(ans,(db)dep[i]+(db)h[i]);
	printf("%.12Lf",ans);
	return 0;
}